<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<jsp:include page="/jsp/header.jsp" />
<jsp:include page="/jsp/footer.jsp" />
<meta charset="utf-8" />
<title>Patron Search</title>
<style type="text/css">
</style>
</head>
<body>
	<div class="page2" style="width: 880px; height: 295px">
		<div id="psContent1">
			<form id="patronSearchForm" action="${WEB_BASE}PatronSearch">
				<input type="text" name="QueryName" class="required" /> <select
					class="psSelect1" name="SearchType">
					<option value="0">Start with</option>
					<option value="1">IS</option>
					<option value="2">End with</option>
					<option value="3">Contains</option>
				</select> <select class="psSelect2" name="SearchColumn">
					<option value="Name">Name</option>
					<option value="Address">Address</option>
					<option value="Phone">Phone</option>
					<option value="Guranter">Guranter</option>
				</select> <input type="submit" name="jButton1" value="Search"
					class="psSearch" />
			</form>
		</div>
		<div id="psContent2">
			<img src="${WEB_BASE }images/Man_Black_64.png" />
		</div>
		<div id="psContent3"
			style="overflow-y: scroll; overflow-x: hidden; height: 220px;">

			<table id="ResTable" border="1" height="45" cellspacing="-1"
				width="880">
				<tr>
					<th rowspan="2">Patron No</th>
					<th rowspan="2">Name</th>
					<th rowspan="2">Guranter Name</th>
					<th rowspan="2">Phone</th>
				</tr>
			</table>
		</div>

	</div>

	<script>
		$(document)
				.ready(
						function() {
							$('#patronSearchForm')
									.submit(
											function() {

												requestPost(
														$(this).attr('action'),
														$(this).serialize(),
														function(out) {
															var results = '';

															for ( var i = 0; i < out.length; i++) {
																results += '<tr><th style="font-weight:normal"><a href="javascript:openPatronView('+out[i].PatNo+');">'
																		+ out[i].PatNo
																		+ '</a></th><th style="font-weight:normal">'
																		+ out[i].Name
																		+ '</th><th style="font-weight:normal">'
																		+ out[i].GuranterName
																		+ '</th><th style="font-weight:normal">'
																		+ out[i].Phone
																		+ '</th></tr>'

															}

															//alert(out[0].Author);
															//alert(out);

															$('#ResTable')
																	.html(
																			'<tr><th>Patron No</th><th>Name</th><th>Guranter Name</th><th>Phone</th></tr>'
																					+ results);

														}, 'json');
												return false;
											});
						});

		function openPatronView(patId) {
			doOverlayOpen('${WEB_BASE}jsp/Search/ViewPatron.jsp?patNo=' + patId);
			return false;
		};
	</script>

	<jsp:include page="/jsp/footer.jsp" />
</body>
</html>
